package pri.zxx.word;

import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
import org.apache.poi.xwpf.usermodel.TextAlignment;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import pri.zxx.word.dat.FontSizeType;
import pri.zxx.word.dat.LineSpaceType;
import pri.zxx.word.dat.TableType;

import java.util.Arrays;
import java.util.List;

@Data
@Accessors(chain = true)
@ConfigurationProperties(prefix = "wd")
@Component
public class WordBaseDataProperties {

    private List<String> resultTableOrder = Arrays.asList("蛋白质","生长性能","蛋品质");
    private List<SentenceInfo> sentenceInfoList;

    @Data
    @Accessors(chain = true)
    public static class SentenceInfo {
        private Integer indentChart;
        private Boolean overFlowPunct = Boolean.TRUE;
        private ParagraphAlignment paragraphAlignment;
        private TextAlignment textAlignment = TextAlignment.AUTO;
        private Double lineSpace = 1.5;
        private Integer stLineSpacingRule = 1;
        private LineSpaceType lineSpaceType = LineSpaceType.POUND;
        private Double lineBefore;
        private Double lineAfter;
        private Boolean pageBreak = false;
        private List<RunInfo> runInfos;
        private TableType tableType = TableType.NONE;
    }

    @Data
    @Accessors(chain = true)
    public static class RunInfo {
        private String text;
        private Boolean bold;
        private Integer fontSize = 12;
        private FontSizeType fontSizeType = FontSizeType.ZN_SIZE;
        private Integer returnCount = 0;
    }
}
